<?php

namespace App\Models\Posts;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class WxTag extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'wx_tags';

    public function getTagsNumberAttribute($v)
    {
        if(_empty_($v)){
            if($v === null){
                WxTag::whereNull('tags_number')->update(['tags_number'=>0]);
            }
            return 0;
        }
        return $v;
    }

}
